<?php
class phanthuong {
    private $itemName, $soluong;
    
    public function __construct() {
        $this->itemName = $this->getItemName();
        $this->soluong = $this->getSoLuong();
    }
    
    public function setItemName($itemName){ $this->itemName = $itemName;  }
    public function getItemName(){ return $this->itemName; }
    
    public function setSoLuong($soluong){ $this->soluong = $soluong; }
    public function getSoLuong(){ return $this->soluong; }
    
    public function getArray(){
        return get_object_vars($this);
    }
}

class noidungevent extends Enum {
    private $mota, $dieukiendatthuong;
    public function __construct() {
        parent::__construct();
        $this->mota = $this->getMota();
        $this->dieukiendatthuong = $this->getDieuKienDatThuong();
    }

    public function setMota($value){ $this->mota = $value; }
    public function getMota(){ return $this->mota; }
    
    public function setDieuKienDatThuong($value){ $this->dieukiendatthuong = $value; }
    public function getDieuKienDatThuong(){ return $this->dieukiendatthuong; }
    
    /**
     * 
     * @type $arr_item
     * @return array()
     * 
     */
    public function tieuchi($arr_item){
        foreach ($arr_item as $key => $value){
            $this->add($key, $value);
        }
    }
    /**
     * 
     * @param type $arr_item
     * @return array()
     * 
     */
    public function mocthoigian($arr_item){
        foreach ($arr_item as $key => $value){
            $this->add($key, $value);
        }
    }
    
    public function getArray(){
        return get_object_vars($this);
    }
}

//$sovongdua=0, $vangthuthap, $diemsotrongluotdua, $soluongvatphamsd, $tieuxu, $tieuvang,
//            $mohopdusoluong, $monhanvat, $suutapthemcacxe, $moibanbe, $tangluot, $sharefacebook, $lanphakyluc

class Enum {
    protected $self = array();
    public function __construct() {
        $args = func_get_args();
        for( $i=0, $n=count($args); $i<$n; $i++ )
            $this->add($args[$i]);
    }
   
    public function __get($value = null ) {
        return $this->self[$value];
    }
   
    protected function add($key = null, $value = null ) {
        if( isset($value) )
            $this->self[$key] = $value;
        else
            $this->self[$key] = end($this->self) + 1;
    }
}


$xx = new noidungevent();
$xx->setMota("123");
$xx->setDieuKienDatThuong("456");
$xx->tieuchi(array("GUINESS" => 25, "MIRROR_POND" => 49));
echo $xx->GUINESS;
var_export($xx->getArray());

//$xx1 = new phanthuong();
//$xx1->setItemName("xxxx");
//$xx1->setSoLuong("xxxx");
//var_dump($xx1->getArray());
?>